package com.cdsf.common.mybatis;

import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Configuration;

/**
 * https://my.oschina.net/u/2278977/blog/1795969
 * mybatis.configuration.map-underscore-to-camel-case=true 这个配置只能对bean返回驼峰命名
 * 自定义CustomMapWrapper 实现驼峰命名转换
 */
@Configuration
public class MybatisConfig {

    /**
     * 此项目命名不规范
     *
     * @return
     */
    //@Bean
    public ConfigurationCustomizer mybatisConfigurationCustomizer() {
        return new ConfigurationCustomizer() {
            @Override
            public void customize(org.apache.ibatis.session.Configuration configuration) {
                configuration.setObjectWrapperFactory(new MapWrapperFactory());
            }
        };
    }

}